import { login } from '@/utils/user'

export default {
  namespaced: true,
  state: {
    token: '',
  },
  mutations: {
    setToken(state, newToken) {
      state.token = newToken
      // uni.setStorageSync('token', newToken)
    },
    clearToken(state) {
      state.token = ''
    },
  },
  actions: {
    async login(context, paramsData) {
      const { data } = await login(paramsData)
      context.commit('setToken', data)
    },
  },
}
